﻿<?php
require('conn.php');
require('session.php');
require('functions.php');
//print_r($userdata);
//noagent();
//全站访问
if($config['fangwen']==4){
	exit('网站正在更新');
}	
$sever=$_SERVER['SERVER_NAME'];
$aid=guolv($_GET['aid']);//任务id
$uid=guolv($_GET['uid']);



if($config['fangwen']==1){
	if(is_mobile()==false){
		exit('仅限手机访问');
	}
}elseif($config['fangwen']==2){
		if(is_weixin()==false){
			exit('仅限微信访问');
		}
}else{
}

//任务提交

if($_POST){
        $tasktjpd=guolv(trim($_POST['tasktj']));
        $tasktj=guolv(trim($_POST['tasktj']));
        $uid=guolv(trim($_POST['uid']));
        $aid=guolv(trim($_POST['aid']));
		$title=guolv(trim($_POST['title']));
		$money=guolv(trim($_POST['money']));
		$title=guolv(trim($_POST['title']));
		$day=date("Y-m-d",time());
	  $time=time();
	
		
		 if($money>$userdata['money']){
  	echo "<script>alert('余额不足！');location.href='jifenlist.php'</script>";exit;
  }
	
         if($tasktjpd==""){
		echo "<script>alert('内容为空,请重新输入!');location.href='jifenlist.php'</script>";
		exit;	
			
	}
	  
	if($tasktjpd!==""){
                
		$arr=array(
			//'id'=>null,
			'uid'=>$uid,
                        'aid'=>$aid,
                        'title'=>guolv(trim($_POST['title'])),
						'pic'=>guolv(trim($_POST['pic'])),
						'pic2'=>guolv(trim($_POST['pic2'])),
						'pic3'=>guolv(trim($_POST['pic3'])),
						'wuliu'=>揽件中,
			'money'=>guolv(trim($_POST['money'])),
			'state'=>0,
			'tasktj'=>$tasktj,
                        'time'=>time(),
						'day'=>date("Y-m-d",time()),
						
		);
		$values=arr2s($arr);
                $mysql->execute("insert into `jifen2` {$values}");
				
				
				$mysql->query("update `userdata` set `money`=`money`-{$money} where `id`='{$uid}'");
			
		$id=mysql_insert_id();
		
			echo "<script>alert('提交信息成功，请耐心等待');location.href='referer.php'</script>";
			exit;			
	
	}
}

?>

<?php if(is_numeric($aid)){
	$row=$mysql->query("select * from `jifen` where `id` in({$aid}) limit 1");
	if($row){
			$data=$row[0];
			$顶部广告=$mysql->query("select * from `addata` where `ad_type`='顶部广告' limit 1");//广告
			$底部广告=$mysql->query("select * from `addata` where `ad_type`='底部广告' limit 1");//广告
			$统计代码=$mysql->query("select * from `addata` where `ad_type`='统计代码' limit 1");//广告
			$微信广告=$mysql->query("select * from `addata` where `ad_type`='微信广告' limit 1");//广告
			$悬浮广告=$mysql->query("select * from `addata` where `ad_type`='悬浮广告' limit 1");//广告
			//统计
		}
}else{
	_location($site,301);
	exit;
}
?>


<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0" />
<link rel="dns-prefetch" href="//res.wx.qq.com">
<link rel="dns-prefetch" href="//mmbiz.qpic.cn">
<link rel="shortcut icon" type="image/x-icon" href="http://res.wx.qq.com/mmbizwap/zh_CN/htmledition/images/icon/common/favicon22c41b.ico">
<title><?php echo $data['title']?></title>
<meta name="keywords" content="<?php echo $data['title']?>"/>
<meta name="description" content="<?php echo $data['title']?>"/>
<link rel="stylesheet" type="text/css" href="<?php echo $site?>/static/all.css" media="all">
<link rel="stylesheet" type="text/css" href="<?php echo $site?>/static/hz.css" media="all">
<script src="<?php echo $site?>/static/jquery.js" type="text/javascript"></script> 
<link rel="stylesheet" href="<?php echo $site?>/editor/themes/default/default.css" />
<link rel="stylesheet" href="<?php echo $site?>/editor/plugins/code/prettify.css" />
<script charset="utf-8" src="<?php echo $site?>/editor/kindeditor.js"></script>
<script charset="utf-8" src="<?php echo $site?>/editor/lang/zh_CN.js"></script>
<script charset="utf-8" src="<?php echo $site?>/editor/plugins/code/prettify.js"></script>

<?php 
$_pic=str_replace('[weixin]','',$data['pic']);
?>
<style type="text/css">
<!--
.STYLE1 {
	color: #FF0000;
	font-weight: bold;
}
.STYLE2 {color: #FF0000}
.STYLE3 {color: #FFFFFF}
.STYLE4 {
	font-weight: bold;
	font-size: 36px;
}
-->
</style>
<div class="fenxiang" id="fg1" onClick="z_yc()" style="display:none"> </div>





<style type="text/css">
#y-iframe{
	position:fixed;
	_position:absolute;
	left:0;
	bottom:0;
	_top:expression(eval(document.documentElement.scrollTop+document.documentElement.clientHeight-this.offsetHeight-(parseInt(this.currentStyle.marginTop,10)||0)-(parseInt(this.currentStyle.marginBottom,10)||0)));
	z-index:99999;
	padding-top:1px;
	width:100%;
	min-height:81px;
	height:auto;
	_height:81px;
	
}
.iframe-wrap{
	position:relative;
	margin:0 auto;
	width:1003px;
	height:81px;
}
</style>


</head>
<body class="mhome" style="font-family:'STXihei';">
<div class="article">
   
</dt>
  <h1><img src="<?php echo $data['pic']?>" alt="" width="294" height="154"/></h1>
  <h1 class="STYLE2"><?php echo $data['money']?>积分</h1>
  <h1><?php echo $data['title']?></h1>
  <div id="tConArt" class="art_co sau">
<div class="rich_media_content" id="js_content">
   <?php echo $data['content']?>
</div>
</div>
<!--任务提交入口 -->

 <div style="font-size:18px;height:30px;line-height:30px;text-align:center;color:red;">
  
   <p><strong>请输入兑换信息</strong></p>
 </div>
 
<form class="contact_form" action="<?php echo $site?>/jifenduihuan.php?aid={$row['id']}&uid={$userdata['id']}" method="post">
<input type="hidden" value="<?php echo $session['id']?>" name="uid">
<input type="hidden" value="<?php echo $data['id']?>" name="aid">
<input type="hidden" value="<?php echo $data['title']?>" name="title">
<label>
<div align="center" class="STYLE1"></div>
</label>

<div align="center">
 <label></label>
  <p>姓名<span class="STYLE3">....
    </span>
    <input name="pic2" type="text" class="txt-input txtpd" style="width:200px;height:20px;" value="" placeholder="备注说明">
  </p>
  <p>&nbsp;  </p>
  <label></label>
  手机号<span class="STYLE3">..</span>
  <input name="pic" type="text" class="txt-input txtpd" style="width:200px;height:20px;" value="" placeholder="备注说明">
  <label></label>
   <p>&nbsp;     </p>
   <p>收货地址
     
     <input name="pic3" type="text" class="txt-input txtpd" style="width:200px;height:20px;" value="" placeholder="必填">
   </p>
   <label></label>	
    <input type="hidden" value="<?php echo $data['money']?>" name="money">
</div>
<div style="text-align:center;text-size:25px;">



  
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p>
    <textarea value="<?php echo $taskdata['tasktj']?>"  name="tasktj" class="txt-input txtpd" placeholder="备注说明" style="width:200px;height:80px;" type="text" ></textarea>
  </p>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <div class="item item-btns"> <button class="btn-login STYLE2 STYLE4" id="loginSubmit" >确认兑换</button>
  </div>
 </div>
</form>
  

<p class="art_txt sau"><span color="red">结束时间：<?php echo $data['endtime']?>&nbsp;&nbsp;<?php
					$row_type=$mysql->query("select * from `jifenduihuan` where `id`='{$data['type']}' limit 1");
				?>
				<?php echo ubb($row_type[0]['type_author'])?></span></p>
  <div id="tConArt" class="art_co sau">


				
		
				<?php 
				if($顶部广告[0]['endtime']!==''){
					if(strtotime($顶部广告[0]['endtime'])>=time()){
						echo $顶部广告[0]['ad_content'];
					}
				}
				?>
				
				
				<div class="rich_media_content" id="js_content">
				<!--内容-->
				<!--<?php echo $data['content']?>-->
				<!--<p>阅读量：<?php echo $data['pv']?></p>-->
				<?php 
				if($底部广告[0]['endtime']!==''){
					if(strtotime($底部广告[0]['endtime'])>=time()){
						echo $底部广告[0]['ad_content'];
					}
				}
				?>					
		

				</div>


</div>
<script src="http://www.lagou.com/js/libs/jquery.1.10.1.min.js"></script>
<script>
    $(function() {
        var pattern = /^http:\/\/mmbiz/;
        var prefix = 'http://img01.store.sogou.com/net/a/04/link?appid=100520031&w=710&url=';
        $("#js_content img").each(function(){
            var src = $(this).attr('src');
            if(pattern.test(src)){
                var newsrc = prefix+src;
                $(this).attr('src',newsrc);
            }
			//$('#js_content').autoIMG();
        });
    });
</script>
<div id="y-iframe">
		<div class="iframe-wrap">
		<div id="dy_02">	
		</div>
		</div>
</div>
<div style="display:none;" id="div_dy_02">
				<?php 
				if($悬浮广告[0]['endtime']!==''){
					if(strtotime($悬浮广告[0]['endtime'])>=time()){
						echo $悬浮广告[0]['ad_content'];
					}
				}
				?>	
</div>



	</div>




<br><br><br><br>

</body>
</html>